import { Component, Vue } from "vue-property-decorator";
import { Constant } from "@/constant";

@Component({})
export class DatePicker extends Vue {
  dateFormat: string = Constant.DATE;
  startTime: moment.Moment = null;
  endTime: moment.Moment = null;

  disabledStartTime(date: moment.Moment) {
    if (!date || !this.endTime) {
      return false;
    }
    return date.valueOf() > this.endTime.valueOf();
  }

  disabledEndTime(date: moment.Moment) {
    if (!date || !this.startTime) {
      return false;
    }
    return this.startTime.valueOf() > date.valueOf();
  }
}

export default DatePicker;
